package repository.beans;

import java.util.List;

import javax.ejb.Stateless;

import model.Department;
import model.Role;
import repository.RoleRepository;
import repository.exceptions.RepositoryException;

@Stateless(name = "RoleRepository", mappedName = "ejb/RoleRepository")
public class RoleRepositoryBean extends BaseRepositoryBean<Role, Long>
		implements RoleRepository {

	public RoleRepositoryBean() {
		super(Role.class);
	}

	@Override
	public Role geRoleByName(String roleAsString) throws RepositoryException {
		for (Role r : this.getAll()) {
			if (r.getTitle().equals(roleAsString)) {
				return r;
			}
		}
		return null;
	}

	@Override
	public List<Role> getRolesByUserName(String user) {
		return null;
	}

}
